package com.qf.zyh.day64springboot.services.Impl;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.qf.zyh.day64springboot.dao.EmpMapper;
import com.qf.zyh.day64springboot.entity.Emp;
import com.qf.zyh.day64springboot.services.EmpServices;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.Collection;
import java.util.List;

@Service
public class EmpServicesImpl implements EmpServices {
    @Resource
    private EmpMapper empMapper;

    @Override
    public List<Emp> getall() {
        return empMapper.getall();
    }

    @Override
    public PageInfo getpage(int page, int limit) {
        PageHelper.startPage(page,limit);
        List<Emp> getall = empMapper.getall();
        PageInfo info = new PageInfo(getall);
        return info;
    }

    @Override
    public boolean login(String ename, String pwd) {
        Emp emp = empMapper.getName(ename);
        if (emp!=null&&emp.getPwd().equals(pwd)) {
            return true;
        }
        return false;
    }
}
